﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ControlYSeguimiento.Domain
{
    [Serializable]
    public class Target
    {
        #region Properties
        public int Id { get; set; }
        public string Name { get; set; }
        public TargetType Type { get; set; }
        public Coordinate CurrentCooridinate { get; set; }
        public string CurrentSpeed { get; set; }
        public string CurrentAltitude { get; set; }
        public string CurrentCourse { get; set; }
        public Customer Customer { get; set; }
        public Device Device { get; set; }
        public string CurrentBatteryLevel { get; set; }
        public bool ShowInMap { get; set; }
        public string TraceTimeSpan { get; set; }
        public string Picture { get; set; }
      //  public string RefreshMapTimer { get; set; }
        #endregion

        #region Navigation Properties
        public string CurrentDeviceId { get { return this.Device.Id.ToString(); } set {  } }
        public string CurrentImei { get { return this.Device.Imei; } set {  } }
        public string CurrentCode { get { return this.Device.Code; } set {  } }
        public string LastUpdateDateTime { get { return Facade.Instance.GetLastUpdateDateTimeByTargetId(this.Id); } set { } }
        #endregion

        public string GetHtmlDescription()
        {
            string info = "<center>";
            info += "<table style='background-image:url();font-size:11px ;'>";
            info += "<tr>";
            info += "<td colspan=\"2\">" + this.Name + "</td>";
            info += "</tr>";
            info += "<tr>";
            info += "<td><img src='/Styles/Images/logocelosos.png' width='80px' height='70px'></td>";
            info += "<td align='left'style='font-size:11px ;'><b>Velocidad actual: </b>" + this.CurrentSpeed + "</br>" +
                                "<b>Altitud: </b>" + this.CurrentAltitude + "</br>" +
                                "<b>Curso: </b>" + this.CurrentCourse + "</td>";
            info += "</tr>";
            info += "</table>";
            info += "</center>";

            return info;
        }

        public override string ToString()
        {
            return this.Name + "[" + Id.ToString() + "]";
        }
    }
}
